package com.bestcem.xm.member.service;

import com.bestcem.xm.common.core.domain.web.ServiceResult;
import com.bestcem.xm.member.entity.pojo.ProjectDO;
import com.bestcem.xm.member.grpc.service.param.extendfield.BatchUpdateFieldsParam;
import com.bestcem.xm.member.grpc.service.param.project.*;
import com.bestcem.xm.member.service.dto.PageDTO;
import com.bestcem.xm.member.service.dto.ProjectDto;
import com.bestcem.xm.member.service.dto.ProjectMemberDto;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Collection;
import java.util.List;

/**
 * @author dc.wang <dc.wang@idiaoyan.com>
 * @version V1.0
 * @description 联系人项目业务层实现类
 * @date 2021/7/19
 */
public interface ProjectService {
    /**
     * 校验企业是否存在重名项目
     * @param validateNameParam 请求参数
     * @return true 存在
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/7/19
     */
    ServiceResult<Boolean> validateName(@NotNull ValidateNameParam validateNameParam);

    /**
     * 查询项目信息
     * @param getProjectParam
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/6/25
     */
    ServiceResult<ProjectDto> getProject(@NotNull GetProjectParam getProjectParam);


    /**
     * 查询项目信息
     * @param listProjectsParam 请求参数
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/6/25
     */
    ServiceResult<List<ProjectDto>> listProjects(@NotNull ListProjectsParam listProjectsParam);

    /**
     * 查询项目信息
     * @param projectIds 项目id集合
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/8/17
     */
    ServiceResult<List<ProjectDto>> listProjectsByIds(@NotEmpty Collection<String> projectIds);

    /**
     * 分页查询项目信息
     * @param listMemberProjectsParam
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/6/25
     */
    ServiceResult<PageDTO<ProjectDto>> listMemberProjects(@NotNull ListMemberProjectsParam listMemberProjectsParam);


    /**
     * 分页模糊搜索项目信息
     * @param fuzzySearchProjectParam 模糊搜索查询
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/6/25
     */
    ServiceResult<PageDTO<ProjectMemberDto>> fuzzySearchProjectManager(@NotNull FuzzySearchProjectParam fuzzySearchProjectParam);

    /**
     * 创建项目
     * @param createProjectParam
     * @return 项目标识
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/6/25
     */
    ServiceResult<String> createProject(@NotNull CreateProjectParam createProjectParam);

    /**
     * 修改项目
     * @param updateProjectParam
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/6/25
     */
    ServiceResult<String> updateProject(@NotNull UpdateProjectParam updateProjectParam);

    /**
     * 批量修改联系人扩展字段
     * @param param 批量更新参数
     * @return
     */
    ServiceResult<Boolean> batchUpdateExtendField(BatchUpdateFieldsParam param);

    /**
     * 删除项目
     * @param deleteProjectParam 请求参数
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/6/25
     */
    ServiceResult<Integer> deleteById(@NotNull DeleteProjectParam deleteProjectParam);

    /**
     * 批量删除项目
     * @param batchDeleteProjectParam
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/6/25
     */
    ServiceResult<Integer> batchDeleteByIds(@NotNull BatchDeleteProjectParam batchDeleteProjectParam);

    /**
     *
     * @param project
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/8/5
     */
    ServiceResult<String> updateProject(ProjectDO project);

    /**
     *
     * @param project
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/8/5
     */
    ServiceResult<String> createProject(ProjectDO project);

    /**
     *
     * @param m_project_name
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/8/5
     */
    ProjectDO findOneByOrgIdAndName(String orgId, String name);

    /**
     *
     *
     * @param orgId
     * @param mProjectCode
     * @return
     */
    List<ProjectDO> findByOrgIdAndMProjectCode(String orgId, String mProjectCode);

    /**
     * 根据orgId 和 memberId 和 projectName 获取数据
     *
     * @param orgId
     * @param mid
     * @param projectName
     * @return
     */
    ProjectDO findOneByOrgIdAndMemberIdAndName(String orgId, String mid, String projectName);

    /**
     * 项目经理投放查询
     * @param param 请求参数
     * @author dc.wang <dc.wang@idiaoyan.com>
     * @date 2021/8/16
     */
    ServiceResult<PageDTO<ProjectMemberDto>> listFilterProjectManager(@NotNull ListFilterProjectManagerParam param);
}
